package demo;


import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.time.LocalDate;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;


/**
* 
* @author : feixiang.li
* @since : 2025-05-27 16:21
*/
public class Test7 {


    public List<String> generateDateRangeList(String queryBeginDay, String queryEndDay) {
        if (queryBeginDay == null || queryEndDay == null) {
            throw new IllegalArgumentException("Both begin date and end date must be provided");
        }

        DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
        LocalDate startDate = LocalDate.parse(queryBeginDay, formatter);
        LocalDate endDate = LocalDate.parse(queryEndDay, formatter);

        if (startDate.isAfter(endDate)) {
            throw new IllegalArgumentException("Begin date cannot be after end date");
        }
        List<String> dateList = new ArrayList<>();
        LocalDate currentDate = startDate;

        while (!currentDate.isAfter(endDate)) {
            dateList.add(currentDate.format(formatter));
            currentDate = currentDate.plusDays(1);
        }
        return dateList;
    }

    public static BigDecimal getTaxBasisAmount(BigDecimal tax){
        BigDecimal result = tax.divide(BigDecimal.valueOf(0.09), 8, RoundingMode.HALF_UP)
                .multiply(BigDecimal.valueOf(1.09));
        return result.setScale(0, RoundingMode.HALF_UP);
    }

    public static void main(String[] args) {
        // 57.80,169.26,125.50,138.71
        BigDecimal tax = new BigDecimal("57.8");
        System.out.println(getTaxBasisAmount(tax));
         tax = new BigDecimal("169.26");
        System.out.println(getTaxBasisAmount(tax));
         tax = new BigDecimal("125.50");
        System.out.println(getTaxBasisAmount(tax));
         tax = new BigDecimal("138.71");
        System.out.println(getTaxBasisAmount(tax));

    }
}
